package szcg.scheduled.service.impl.ydcg;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import szcg.scheduled.service.entity.ydcg.CaseBean;
import szcg.scheduled.service.service.ydcg.CaseEntryService;

import java.util.List;

@Service
public class CaseEntryServiceImpl implements CaseEntryService {

    @Qualifier("MainSqlSessionFactory")
    private final SqlSessionFactory sqlSessionFactory;

    public CaseEntryServiceImpl(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }

    @Override
    public void addBatchCase(List<CaseBean> fullCaseList) {
        if (fullCaseList != null && !fullCaseList.isEmpty()) {
            try (SqlSession session = sqlSessionFactory.openSession(true)) {
//                CityCaseMapper mapper = session.getMapper(CityCaseMapper.class);
//                mapper.addBatchCase(fullCaseList);
            }
        }
    }
}
